Skip to main content

Linearizability

Its the idea of appearing like there's only a single node while still having multiple replicas. And all operations looking like they are atomic. Whenever a write is done, all clients reading the service, as example a database, should be able to see the recent change immediately.

Linearizability and Serializability differ, because serializability is about sequential execution of concurrent transactions. Linearizability is just the idea of having a recency-guarantee when reading data;

Linearizability is kinda important for locking and leader election, e.g, when all nodes startup we need to ensure they are electing a single leader and not causing split-brain, or a unique constraint on a database.

How to implement it on your system?

What kind of Distributions Models are linearizable?

StrategyWorks?
Single Leader ReplicationPotentially
Consensus AlgorithmYes!
Multi-LeaderNope
LeaderlessAlmost certainly not

For leaderless, as example DynamoDB, theres a claim that with a quorum-reads and writes(w + r > N), we can reach a linearizable system, which is not exactly true - Only if you sacrifice performance requiring reads and writes to read the last state. Last-Write-Wins from Cassandra, fall into Clock Issues and Clock Skew and are almost certainly non linearizable.

Single Leader is only linearizable on a single datacenter deployment. Might not be solution for all, since with multi datacenters, it loses linearizability on networks failures. It is a know problem and consequence of Single or Multi-Leader with multiple datacenters deployment.